module.exports = function(grunt) {

    // 1. All configuration goes here 
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),

        concat: {
            js: {
                src: [
                    //'src/js/jquery-1.10.2.js', 
                    'src/js/bootstrap.js', 
                    'src/js/script.js'  
                ],
                dest: 'assets/js/script.js'
            },
            css: {
                src:[
                    'src/css/bootstrap.css', 
                    'src/css/font-awesome.css', 
                    'src/css/style.css' 
                ],
                dest: 'assets/css/style.css'
            }
        },
        uglify: {
            build: {
                src: 'assets/js/script.js',
                dest: 'assets/js/script.min.js'
            }
        },
        imagemin: {
            dynamic: {
                files: [{
                    expand: true,
                    cwd: 'src/img/',
                    src: ['**/*.{png,jpg,gif}'],
                    dest: 'assets/img/'
                }]
            }
        },
        cssmin: {
            dist: {
                options: {
                    keepSpecialComments: 0
                },
                files: {
                    'assets/css/style.min.css': ['assets/css/style.css']
                }
            }
        },
        copy: {
            ico: {
                expand: true,
                cwd: 'src/ico/',
                src: '*',
                dest: 'assets/ico/',
                flatten: true,
                filter: 'isFile',
            },
            fonts: {
                expand: true,
                cwd: 'src/fonts/',
                src: '*',
                dest: 'assets/fonts/',
                flatten: true,
                filter: 'isFile',
            },
            htmlshiv: {
                expand: true,
                src: 'src/js/html5shiv.js',
                dest: 'assets/js/',
                flatten: true,
                 filter: 'isFile',
            },
            respond: {
                expand: true,
                src: 'src/js/respond.min.js',
                dest: 'assets/js/',
                flatten: true,
                 filter: 'isFile',
            },
        },
        watch: {
            js: {
                files: ['src/js/*.js'],
                tasks: ['concat', 'uglify'],
                options: {
                    spawn: false,
                },
            },
            css: {
                files: ['src/css/*.css'],
                tasks: ['concat', 'cssmin'],
                options: {
                    spawn: false,
                },
            },
            img: {
                files: ['src/img/**/*.{png,jpg,gif}'],
                tasks: ['imagemin'],
                options: {
                  event: ['added', 'changed'],
                }
            },
            ico: {
                files: ['src/ico/**'],
                tasks: ['copy'],
                options: {
                  event: ['added', 'changed'],
                }
            },
            font: {
                files: ['src/fonts/**'],
                tasks: ['copy'],
                options: {
                  event: ['added', 'changed'],
                }
            }
        }

    });

    // 3. Where we tell Grunt we plan to use this plug-in.
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-imagemin');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-copy');

    // 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
    grunt.registerTask('default', ['concat', 'uglify' , 'cssmin' , 'imagemin' , 'copy']);

};
